package co.yixiang.retail.biz.order.controller;


import co.yixiang.common.log.annotation.Log;
import co.yixiang.common.mproot.dozer.service.IGenerator;
import co.yixiang.retail.biz.user.sevice.YxSystemStoreService;
import co.yixiang.retail.common.domain.YxSystemStore;
import co.yixiang.retail.common.dto.YxSystemStoreQueryCriteria;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.data.domain.Pageable;
import org.springframework.http.HttpStatus;
import org.springframework.http.ResponseEntity;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

/**
 * @author hupeng
 * @date 2020-03-03
 */
@Api(tags = "门店")
@RestController
@RequestMapping("/store")
public class YxSystemStoreController {

    private final YxSystemStoreService yxSystemStoreService;
    private final IGenerator generator;
    public YxSystemStoreController(YxSystemStoreService yxSystemStoreService, IGenerator generator) {
        this.yxSystemStoreService = yxSystemStoreService;
        this.generator = generator;
    }
    //1 、门店列表 根据类型查询
    @Log("所有门店")
    @ApiOperation("所有门店")
    @GetMapping(value = "/storeByType")
    public ResponseEntity<Object> getAll(YxSystemStoreQueryCriteria criteria,Pageable pageable) {
        return new ResponseEntity<>(yxSystemStoreService.queryByType(criteria,pageable), HttpStatus.OK);
    }
    //1 、门店列表 根据类型查询
    @Log("查询门店信息")
    @ApiOperation("查询门店信息")
    @GetMapping(value = "/queryBalace")
    public ResponseEntity<Object> queryBalace(Integer id) {
        YxSystemStore yxSystemStore = yxSystemStoreService.queryBalace(id);
        return new ResponseEntity<>(yxSystemStore, HttpStatus.OK);
    }



}
